#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_log.h"
#include "driver/gpio.h"
void BDR6120_Init(void)
{
    gpio_config_t gpio_conf = {
        .pin_bit_mask = (1ULL << GPIO_NUM_4) | (1ULL << GPIO_NUM_5),
        .mode = GPIO_MODE_OUTPUT,
        .pull_up_en = 0,
        .pull_down_en = 0,
        .intr_type = GPIO_INTR_DISABLE};
    gpio_config(&gpio_conf);
}
static void BDR6120_Front(void)
{
    gpio_set_level(GPIO_NUM_4, 1);
    gpio_set_level(GPIO_NUM_5, 0);
}
static void BDR6120_Later(void)
{
    gpio_set_level(GPIO_NUM_4, 0);
    gpio_set_level(GPIO_NUM_5, 1);
}
static void BDR6120_Wait(void)
{
    gpio_set_level(GPIO_NUM_4, 0);
    gpio_set_level(GPIO_NUM_5, 0);
}
static void BDR6120_Stop(void)
{
    gpio_set_level(GPIO_NUM_4, 1);
    gpio_set_level(GPIO_NUM_5, 1);
}
void BDR6120_Lock(void)
{
    BDR6120_Later();
    vTaskDelay(10);
    BDR6120_Front();
    vTaskDelay(10);
    BDR6120_Stop();
    ESP_LOGE("BDR6120", "Lock");
}
void BDR6120_UnLock(void)
{
    BDR6120_Front();
    vTaskDelay(10);
    BDR6120_Later();
    vTaskDelay(10);
    BDR6120_Wait();
    ESP_LOGE("BDR6120", "UnLock");
}
void app_main(void)
{
    BDR6120_Init();
    BDR6120_Lock();
    BDR6120_UnLock();
    while (1)
    {
        vTaskDelay(1000 / portTICK_PERIOD_MS);
    }
}